﻿using Microsoft.Xna.Framework;
using System;
using AIniciacao.Lib.Resources;
public class WorldTime
{

    #region Fields
    
    private DateTime dateTimeFinal;
    private TimeSpan timeDiff;
    private Boolean timeHandled = false;
    
    #endregion


    #region Constructor


    public WorldTime(double minutes, double seconds)
    {            
        dateTimeFinal = DateTime.Now;
        dateTimeFinal = dateTimeFinal.AddMinutes(minutes);
        dateTimeFinal = dateTimeFinal.AddSeconds(seconds);
    }
    
    
    #endregion

    #region Methods

    public void addTime(double minutes, double seconds)
    {
        dateTimeFinal = dateTimeFinal.AddMinutes(minutes);
        dateTimeFinal = dateTimeFinal.AddSeconds(seconds);      
    }
 
    public override string ToString()
    {
        return string.Format(AIniciacaoResourceManager.getProperty("label_remaining_time")+" {0:00}:{1:00} ",  timeDiff.Minutes ,timeDiff.Seconds);
        
    }

    public void Update(GameTime gameTime)
    {
        timeDiff = dateTimeFinal.Subtract(DateTime.Now);
             
       
    }

    public Boolean IsTimeUp
    {
        get
        {
            return timeDiff.Seconds < 0;
        }
    }
    public Boolean TimeHandled
    {
        get
        {
            return timeHandled;
        }
        set
        {
            timeHandled = value;
        }
    }
    #endregion

}